package com.wrk._1_语法._04_循环._01_单循环;

import java.util.Scanner;

public class _006_正整数分解质因数 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入正整数,我来分解质因数:");
        //
        int positiveInteger =scanner.nextInt();
        int a=0;
        //
        for (int primeNumber=2;primeNumber<=positiveInteger;primeNumber++){
            if (positiveInteger%primeNumber==0){
                positiveInteger=positiveInteger/primeNumber;
                a++;
                System.out.print("质因数"+a+"为:"+primeNumber+"\t");
            }
        }
        scanner.close();
    }
}
